package com.honey.standard.writer.io;

import java.io.File;

import com.honey.core.compiler.StorageType;

public class StorageFactory {

	/**
	 * 构造存储对象
	 * @param storageType 存储类型
	 * @param source 文件 
	 * @param charset 字符集
	 * @return
	 */
	public static Storage getStorage(StorageType storageType,File source, String charset, boolean checked ){
		Storage answer = null;
		switch( storageType ){
			case BACKUP_STORAGE:
				answer = new BackupStorage(source,charset,checked);
				break ;
			
			case MULTI_STORAGE:
				answer = new MultiStorage(source,charset,checked);
				break ;
			
			case OVERRIDE_STORAGE:
				answer = new OverrideStorage(source,charset,checked);
				break ;
				
			case CHECKING_STORAGE:
				answer = new CheckingStorage(source,charset,checked);
				break ;
				
			case CHECKING_BACKUP_STORAGE:
				answer = new CheckingAndBackupStorage(source,charset,checked);
				break ;
		
			case CHECKING_MULTI_STORAGE:
				answer = new CheckingAndMultiStorage(source,charset,checked);
				break ;
			
		}
		
		return answer;
	}
}
